package com.xrui.hbase.schema;

import com.moz.kiji.delegation.NamedProvider;
import com.xrui.hbase.exception.InvalidLayoutException;

import java.util.function.Supplier;

public interface TableLayoutResolver extends NamedProvider {
    static TableLayoutResolver create(Supplier<TableLayoutResolver> supplier) {
        return supplier.get();
    }

    /**
     * Resolves a table into a TableLayout object.
     *
     * @param tableName The table name of table to resolve the layout.
     * @param resource  The additional resource to resolve the layout.
     * @return the resolved TableLayout object.
     * @throws InvalidLayoutException when resolved the layout failed.
     */
    TableLayout resolve(String tableName, Object resource)
        throws InvalidLayoutException;
}
